﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Corsat.Library.Logic;
using Corsat.Library;

namespace Corsat.Web._2013
{
    public partial class PrintableRegistrationForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //Session["CorsatId"] = 9789;
            //if (Session["CorsatId"] != null)
            if (Session["AccountId"] != null)
            {
                //List<SmallAccount> Accounts = Corsat.Library.DataManager.Main.GetAllAccounts();
                //int CorsatId = Convert.ToInt32(Session["CorsatId"].ToString());

                //SmallAccount acc = Accounts.Find(
                //    delegate(SmallAccount bk)
                //        {
                //            return bk.CorsatId == Convert.ToInt32(CorsatId);
                //        });

                int accountId = Convert.ToInt32(Session["AccountId"].ToString());
                if (accountId != 0)
                {
                    Account x = new Account(accountId);

                    lblName.Text = x.ArabicName;
                    lblEmail.Text = x.Email;
                    lblBirthDate.Text = x.BirthDate.ToString("d-M-yyyy");
                    lblChurch.Text = x.Church.Value;
                    lblDiocese.Text = x.Diocese.Value;
                    lblSSN.Text = x.SSN;
                    lblCorsatId.Text = Session["CorsatId"].ToString();
                    dlTelephones.DataSource = x.Telephones;
                    dlTelephones.DataBind();

                    dlCourses.DataSource = x.Courses;
                    dlCourses.DataBind();
                }
            }
        }
    }
}